/********************************************************************************
 * Project Name		[JavaEE_Web]
 * File Name     	[StudentCriteria.java]
 * Creation Date 	[2015-01-01]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ********************************************************************************/
package mvc.dao;

import mvc.domain.Student;

/**
 * 一个按条件查询学生的封装
 * 
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 * 
 */
public class StudentCriteria {

	private Student student = null;

	public StudentCriteria(Student student) {
		this.student = student;
	}

	public String getName() {
		return createCriteria(student.getName());
	}

	public void setName(String name) {
		this.student.setName(name);
	}

	public String getGender() {
		return createCriteria(student.getGender());
	}

	public void setGender(String gender) {
		this.student.setGender(gender);
	}

	private String createCriteria(String columnValue) {
		if (columnValue == null) {
			columnValue = "%%";
		} else {
			columnValue = "%" + columnValue + "%";
		}
		return columnValue;
	}
}
